<template>
    <div class="box5">
        <div class="title">
            <p>未来七天游客数量趋势图</p>
            <img src="../../images/dataScreen-title.png">
        </div>
        <div class="charts" ref="charts"></div>
    </div>
</template>
<script setup lang='ts'>
import { ref, onMounted } from 'vue'
// 引入echarts
import * as echarts from 'echarts'
// 获取节点
let charts = ref();
onMounted(() => {
    let mycherts = echarts.init(charts.value);
    // 设置配置项
    mycherts.setOption({
        // 标题组件
        title: {
            text: '访问量',
        },
        // X|Y轴
        xAxis: {
            // 两侧不留白
            boundaryGap: false,
            type: 'category',
            // 去掉分割线
            splitLine: {
                show: false
            },
            data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日',]
        },
        yAxis: {
            // 去掉分割线
            splitLine: {
                show: false
            },
            axisLine: {
                show: true
            },
            // 刻度
            axisTick: {
                show: true
            }

        },//系列
        series: [
            {
                type: 'line',
                data: [120, 240, 66, 600, 321, 890, 555],
                // 设置为平滑的曲线
                smooth: true,
                // 区域填充的颜色
                areaStyle: {
                    color: {
                        type: 'liner',
                        x: 0,
                        y: 0,
                        x2: 0,
                        y2: 1,
                        colorStops: [{
                            offset: 0, color: 'red'//0%处的颜色
                        }, {
                            offset: 1, color: 'blue'//100%处的颜色
                        }],
                        global: false//缺省值为false
                    }
                }
            }
        ]
    })
})
</script>
<style lang='scss' scoped>
.box5 {
    margin-left: 10px;
    width: 100%;
    height: 100%;
    background: url(../../images/dataScreen-main-cb.png) no-repeat;
    background-size: 100% 100%;
    color: white;

    .title {
        margin-left: 20px;

        p {
            color: white;
            font-size: 20px;
        }
    }

    .charts {
        height: 300px;
    }
}
</style>